package top.minuy.structure.tree.segment;
/**
 * @author Minuy
 * @time 16:12
 * @date 2021/10/4
 */
public class Test {
    public static void main(String[] args) {
        Integer[] arr = {1, 4, 6, 9, 7, 2, 1, -9};
        SegmentTree<Integer> segmentTree = new SegmentTree<>(arr, (a, b) -> a + b);
        System.out.println(segmentTree);
        System.out.println(segmentTree.query(0, 2));
        System.out.println(segmentTree.query(3, 6));
        segmentTree.set(2,0);
        System.out.println(segmentTree);
        System.out.println(segmentTree.query(0, 2));
        System.out.println(segmentTree.query(3, 6));
    }
}
